1 /* 2 * Copyright (c) 2013-2014 - Mauro Carvalho Chehab <m.chehab@samsung.com> 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation version 2.1 of the License. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU Lesser General Public License for more details. 12 * 13 * You should have received a copy of the GNU Lesser General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 17 * 18 * Described on ARIB STD-B10 as TS information descriptor 19 */ 20 21 /** 22 * @file desc_ts_info.h 23 * @ingroup descriptors 24 * @brief Provides the descriptors for the ISDB TS information descriptor. 25 * The TS information descriptor specifies the remote control key 26 * identifier assigned to the applicable TS and indicates the relationship 27 * between the service identifier and the transmission layer during 28 * hierarchical transmission. 29 * 30 * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1) 31 * @author Mauro Carvalho Chehab 32 * 33 * @par Relevant specs 34 * The descriptor described herein is defined at: 35 * - ARIB STD-B10 36 * 37 * @par Bug Report 38 * Please submit bug reports and patches to linux-media@vger.kernel.org 39 */ 40 41 module libdvbv5_d.desc_ts_info; 42 43 import libdvbv5_d.descriptors: dvb_desc; 44 import libdvbv5_d.dvb_fe: dvb_v5_fe_parms; 45 46 extern (C): 47 48 /** 49 * @struct dvb_desc_ts_info_transmission_type 50 * @ingroup descriptors 51 * @brief ISDB TS information transmission type 52 * 53 * @param transmission_type_info transmission type info 54 * @param num_of_service num of service 55 */ 56 struct dvb_desc_ts_info_transmission_type 57 { 58 align (1): 59 60 ubyte transmission_type_info; 61 ubyte num_of_service; 62 } 63 64 /** 65 * @struct dvb_desc_ts_info 66 * @ingroup descriptors 67 * @brief Structure describing the ISDB TS information descriptor. 68 * 69 * @param type descriptor tag 70 * @param length descriptor length 71 * @param next pointer to struct dvb_desc 72 * @param remote_control_key_id remote control key id 73 * @param length_of_ts_name length of ts name 74 * @param transmission_type_count transmission type count 75 * 76 * @param ts_name ts name string 77 * @param ts_name_emph ts name emphasis string 78 * @param transmission_type struct dvb_desc_ts_info_transmission_type content 79 * @param service_id service id vector 80 */ 81 struct dvb_desc_ts_info 82 { 83 align (1): 84 85 ubyte type; 86 ubyte length; 87 dvb_desc* next; 88 89 char* ts_name; 90 char* ts_name_emph; 91 dvb_desc_ts_info_transmission_type transmission_type; 92 ushort* service_id; 93 94 union 95 { 96 ushort bitfield; 97 98 struct 99 { 100 import std.bitmanip : bitfields; 101 align (1): 102 103 mixin(bitfields!( 104 ubyte, "transmission_type_count", 2, 105 ubyte, "length_of_ts_name", 6, 106 ubyte, "remote_control_key_id", 8)); 107 } 108 } 109 } 110 111 // struct dvb_v5_fe_parms; 112 113 /** 114 * @brief Initializes and parses the ISDB TS information descriptor. 115 * descriptor 116 * @ingroup descriptors 117 * 118 * @param parms struct dvb_v5_fe_parms pointer to the opened device 119 * @param buf buffer containing the descriptor's raw data 120 * @param desc pointer to struct dvb_desc to be allocated and filled 121 * 122 * This function allocates a the descriptor and fills the fields inside 123 * the struct. It also makes sure that all fields will follow the CPU 124 * endianness. Due to that, the content of the buffer may change. 125 * 126 * @return On success, it returns the size of the allocated struct. 127 * A negative value indicates an error. 128 */ 129 int dvb_desc_ts_info_init ( 130 dvb_v5_fe_parms* parms, 131 const(ubyte)* buf, 132 dvb_desc* desc); 133 134 /** 135 * @brief Prints the content of the ISDB TS information descriptor. 136 * descriptor 137 * @ingroup descriptors 138 * 139 * @param parms struct dvb_v5_fe_parms pointer to the opened device 140 * @param desc pointer to struct dvb_desc 141 */ 142 void dvb_desc_ts_info_print (dvb_v5_fe_parms* parms, const(dvb_desc)* desc); 143 144 /** 145 * @brief Frees all data allocated by the ISDB TS information descriptor. 146 * descriptor 147 * @ingroup descriptors 148 * 149 * @param desc pointer to struct dvb_desc to be freed 150 */ 151 void dvb_desc_ts_info_free (dvb_desc* desc);